export const after = second => {
  return new Promise(resolve => {
    setTimeout(function() {
      resolve();
    }, second * 1000);
  });
};

export class Formatter {

  static padNumber(n){
    if (n < 10) {
      return '0' + n
    }
    return n
  }

  static format(d) {
    if (typeof d === 'string'){
      return d
    }
    return `${d.getFullYear()}-${this.padNumber(d.getMonth() + 1)}-${this.padNumber(d.getDate())}`;
  }

  static parse(d) {
    return new Date(d);
  }
}
